/** 
 * Copyright (C), 2010-2012, AIYOU Software Co.,Ltd. ALL RIGHTS RESERVED. 
 * File name:TietiaoConstants.java
 * Version:1.0
 * Date:2011-12-25
 * Description: 
 * author:whh 
 */
package com.tietiao.common.constants;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.tietiao.common.util.PropertyUtil;
import com.tietiao.webservice.qq.beans.OAuth;


public class TietiaoConstants {
	public static String SEND_MAIL_FROM = "";
	public static String SEND_MAIL_PASSWORD = "";
	public static String SEND_MAIL_SHOWNAME = "";
	public static String SEND_MAIL_SMTP_HOST = "";
	public static String TIETIAO_WEB_SITE = "http://www.itietiao.com";
	//图片类型，图片大小
	public static  String PHOTO_ALL0W_FILE = PropertyUtil.getValue("COMMODITY_ALL0W_FILE_SUFFIX");
	public static  Integer PHOTO_ALL0W_MAX_SIZE = Integer.parseInt(PropertyUtil.getValue("PHOTO_ALL0W_MAX_SIZE"));
	
	//图片允许的最小(大)分辨率 
	public static Integer PHOTO_ALLOW_MIN_H = Integer.parseInt(PropertyUtil.getValue("HEAD_PHOTO_ALLOW_MIN_H"));
	public static Integer PHOTO_ALLOW_MIN_W = Integer.parseInt(PropertyUtil.getValue("HEAD_PHOTO_ALLOW_MIN_W"));
	public static Integer PHOTO_ALLOW_MAX_H = Integer.parseInt(PropertyUtil.getValue("HEAD_PHOTO_ALLOW_MAX_H"));
	public static Integer PHOTO_ALLOW_MAX_W = Integer.parseInt(PropertyUtil.getValue("HEAD_PHOTO_ALLOW_MAX_W"));

	public static String PIC_ROOT_PATH = PropertyUtil.getValue("COMMODITY_PIC_ROOT_PATH");
	public static String SERVICE_ROOT_PATH = PropertyUtil.getValue("PIC_SERVER");
	public static Integer RESULT_USER_PHOTO_H = Integer.parseInt(PropertyUtil.getValue("HEAD_RESULT_USER_PHOTO_H"));
	public static Integer RESULT_USER_PHOTO_W = Integer.parseInt(PropertyUtil.getValue("HEAD_RESULT_USER_PHOTO_W"));
	
	// AppKey(client CRredentials)
	public static String QQ_OAUTH_CONSUMER_KEY = "801088111";
	// 签名密钥1
	public static String QQ_OAUTH_CONSUMER_SECRET = "6c78d50747a573b415d0c8820ed84562";
	// 认证成功后浏览器会被重定向到这个URL中
	public static String QQ_OAUTH_CALLBACK = "http://www.tietiao.com/tietiao/member_webService_oauthQQSuccess.htm";
	public static String RENREN_CALLBACK = "";
	public static String KAIXIN_CONSUMER_KEY="";
	public static String KAIXIN_CONSUMER_SECRET="";
	public static String KAIXIN_REDIRECT_URI="";
	
	
	static {
        InputStream in = OAuth.class.getClassLoader().getResourceAsStream("apiconfig.properties");
        Properties properties = new Properties();
        try {
            properties.load(in);
            QQ_OAUTH_CONSUMER_KEY = properties.getProperty("qq.app.id",QQ_OAUTH_CONSUMER_KEY);
            QQ_OAUTH_CONSUMER_SECRET = properties.getProperty("qq.app.key",QQ_OAUTH_CONSUMER_SECRET);
            QQ_OAUTH_CALLBACK = properties.getProperty("qq.oauth.callback", QQ_OAUTH_CALLBACK);
            RENREN_CALLBACK = properties.getProperty("renren.callback", RENREN_CALLBACK);
            KAIXIN_CONSUMER_KEY = properties.getProperty("kaixin.consumer.key", KAIXIN_CONSUMER_KEY);
            KAIXIN_CONSUMER_SECRET = properties.getProperty("kaixin.consumer.secret", KAIXIN_CONSUMER_SECRET);
            KAIXIN_REDIRECT_URI = properties.getProperty("kaixin.redirect.uri", KAIXIN_REDIRECT_URI);
            
            SEND_MAIL_FROM = properties.getProperty("send.mail.from");
            SEND_MAIL_PASSWORD = properties.getProperty("send.mail.password");
            SEND_MAIL_SHOWNAME = properties.getProperty("send.mail.showname");
            SEND_MAIL_SMTP_HOST = properties.getProperty("send.mail.smtp.host");
        } catch (IOException e) { 
        	e.printStackTrace();
        }
    }
}
